//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package org.come.until;

import java.io.IOException;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.httpclient.methods.PostMethod;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;

public class sendsms {
	private static String Url = "http://106.ihuyi.cn/webservice/sms.php?method=Submit";

	public sendsms() {
	}

	public static String sendUNtil(String phone) {
		HttpClient client = new HttpClient();
		PostMethod method = new PostMethod(Url);
		client.getParams().setContentCharset("GBK");
		method.setRequestHeader("ContentType", "application/x-www-form-urlencoded;charset=GBK");
		int mobile_code = (int)((Math.random() * 9.0D + 1.0D) * 100000.0D);
		String content = new String("您的验证码是：" + mobile_code + "。请不要把验证码泄露给其他人。");
		NameValuePair[] data = new NameValuePair[]{new NameValuePair("account", "C69900359"), new NameValuePair("password", "6e0a061805272583c415c312caabaea4"), new NameValuePair("mobile", phone), new NameValuePair("content", content)};
		method.setRequestBody(data);

		try {
			client.executeMethod(method);
			String SubmitResult = method.getResponseBodyAsString();
			Document doc = DocumentHelper.parseText(SubmitResult);
			Element root = doc.getRootElement();
			String code = root.elementText("code");
			String msg = root.elementText("msg");
			String smsid = root.elementText("smsid");
			if ("2".equals(code)) {
				String var13 = String.valueOf(mobile_code);
				return var13;
			}

			return "error";
		} catch (HttpException var18) {
			var18.printStackTrace();
		} catch (IOException var19) {
			var19.printStackTrace();
		} catch (DocumentException var20) {
			var20.printStackTrace();
		} finally {
			method.releaseConnection();
		}

		return content;
	}
}
